package com.ly.mpayment.persist.service.downrechargeflow;

import java.util.List;
import java.util.Map;

import com.ly.mpayment.persist.entity.*;
import com.ly.mpayment.persist.hibernate.Page;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public interface IDownRechargeFlowService {

	public DownRechargeFlow findById(String id);

	public DownRechargeFlow findByIdWating(String id);

	public DownRechargeFlow findByUUid(String id);

//	public DownRechargeFlow findByUUidMaintenance(String id);

	public DownRechargeFlow addDownrechargeflow(DownRechargeFlow flow,DownShopInfo downShop);

	public boolean updateDownrechargeflow(DownRechargeFlow flow,DownShopInfo shop);

	public boolean updateDownrechargeflow(DownRechargeFlow flow);

	public void updatedeductionBalance(DownRechargeFlow flow,DownShopInfo shop);

	public boolean updateDownrechargeflow(DownRechargeFlow flow,int callStatus,int callNum);

	public boolean updateDownrechargeflow(String downorderuuid, int callNum);

	public boolean updateDownrechargeflowRefund(DownRechargeFlow flow,String errorMsg);

	public Page<DownRechargeFlow> findPageDownrechargeflow(Map<String, Object> parameters ,int start,int pageSize);

	public Object findByShopId(String requestId,String uid);

	public List<DownRechargeFlow> findOrderFail(int pageSize);

	public List<DownRechargeFlow> findOrderMaintenance(int pageSize);

	/**
	 * 取消订单上游 下游订单都不为空时执行
	 * @param flow
	 * @param shop
	 * @param upOrder
	 * @param shopUp
	 * @return
	 */
	public boolean updateCanelOrder(DownRechargeFlow flow, DownShopInfo shop, UpOrder upOrder, UpShopInfo shopUp, int status, User user);

	/**
	 * 取消订单上游 下游订单都不为空时执行
	 * @param flow
	 * @param shop
	 * @param upOrder
	 * @param shopUp
	 * @return
	 */
	public boolean updateCanelSuccessOrder(DownRechargeFlow flow,DownShopInfo shop,UpOrder upOrder,UpShopInfo shopUp);

	/**
	 * 上游订单为空时执行
	 * @param flow
	 * @param shop
	 * @return
	 */
	public boolean updateCanelOrder(DownRechargeFlow flow,DownShopInfo shop,int status,User user);

	public String getDownCount(Map<String, Object> parameters ,int start,int pageSize);

	public JSONArray exportDownCount(Map<String, Object> parameters );
//
//	public List findBackAmount();
//
//	public List findDiscount();
//
	public List exportdataFlowOrder(Map<String, Object> map);
//
//	public List findRefund();


//	public DownRechargeFlow findUseruuidTime(String useruuid,Date date);

//	public List<String> rechargeFail();

	public DownRechargeFlow findShopUUIDorder(String requestId,String uid);

	public String findDownFlowCount(JSONObject json, int start, int pageSize);

	public JSONArray exportDataDown(JSONObject json);

//	public void orderRefund(UpOrder order, IUporderService upOrderService, IDownRechargeFlowService flowService,
//							IDownShopInfoService shopService, ThreadPoolTaskExecutor taskExecutor,String errorMsg);
	/**
	 * 退款订单
	 */
//	public String refundOrder(UpOrder order,IUporderService upOrderService,IDownRechargeFlowService flowService,IDownShopInfoService shopService,ThreadPoolTaskExecutor taskExecutor,String errorMsg);

	public List<DownRechargeFlow> findOrderNotCallFail(int pageSize);

	void updateOrderFailt(UpOrder orderUp, String errorMsg);

    DownRechargeFlow findByOrderId(String downorderuuid);

	Integer findByPhoneCount(String string);

	Page<DownRechargeFlow> findByPagePhone(Map<String, Object> parameters, int start, int pageSize);


    void addOrderMsg(DownRechargeFlow flow);

	int findbyProduct(String downprouuid);

    String findDownOrderCount(JSONObject json, int start, int pageSize);
}
